package com.spark.check

import android.os.Bundle
import android.view.ViewGroup
import android.widget.LinearLayout
import com.just.agentweb.AgentWeb
import com.spark.common.BaseFragment
import com.spark.common.widget.CoolIndicatorLayout
import kotlinx.android.synthetic.main.frag_std_chk_detail.*

/**
 * 检查详情
 */
class StdChkDetailFragment : BaseFragment() {
    companion object {
        fun newInstance(): StdChkDetailFragment {
            val fragment = StdChkDetailFragment()
            val args = Bundle()

            fragment.arguments = args
            return fragment
        }
    }

    override fun contentResId(): Int {
        return R.layout.frag_std_chk_detail
    }

    override fun onLazyInitView(savedInstanceState: Bundle?) {
        super.onLazyInitView(savedInstanceState)
        iv_back.setOnClickListener { pop() }
        context?.apply {
            AgentWeb.with(this@StdChkDetailFragment)
                    .setAgentWebParent(ll_web as LinearLayout, LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT))
                    .setCustomIndicator(CoolIndicatorLayout(this))
                    .createAgentWeb()
                    .ready()
                    .go("http://www.zhihu.com")
        }
    }
}